package com.bzkj.basicinfo.service.impl.yxl;

import com.bzkj.basicinfo.domain.yxl.Customer;
import com.bzkj.basicinfo.domain.yxl.CustomerDto;
import com.bzkj.basicinfo.mapper.YxlCustomerMapper;
import com.bzkj.basicinfo.service.yxl.CustomerService;
import com.bzkj.common.annotation.DataSource;
import com.bzkj.common.enums.DataSourceType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author：swj
 * @Desc
 * @Date：2025/7/21 11:52
 */
@Service
@Slf4j
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    private YxlCustomerMapper customerMapper;

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Customer> queryCustomerList(CustomerDto dto) {
        List<Customer> resultList;
        if (dto.getType().equals("1")) {//客户
            resultList = customerMapper.queryCustomerList(dto);
        } else {//供应商
            resultList = customerMapper.querySupplierList(dto);
        }
        return resultList;
    }
}
